package com.baseLearn.api.util;

import com.baseLearn.api.exception.ZjmsaOaException;
import com.baseLearn.config.ApplicationContextRegister;

public class ApplicationContextUtil {

    public static <T> T getBean(String name) {
        Object object = ApplicationContextRegister.getApplicationContext()
                .getBean(name);
        if (object==null){
            throw new ZjmsaOaException("系统异常");
        }
        return (T) object;
    }

}
